<include file="public@header"/>
</head>
<style>
	td input,td select{ width:auto; max-width:180px;}
	.form-horizontal .control-group1 {
		float: left;
		width: 15%;
		margin-bottom: 20px;
	}
	.form-horizontal .control-label {width:80px;}
	.form-horizontal .controls {margin-left:90px;}
	input,select, textarea, .uneditable-input {
		max-width: 580px;
		width:100px;
		min-width:auto;
	}

</style>
<body>
	<php>$page='';$vo['id']='';</php>
	<div class="wrap js-check-wrap">
		<ul class="nav nav-tabs">
			<li class="active"><a href="{:url('Aftersale/burial')}">墓区安葬</a></li>
<!--			<li><a href="{:url('Aftersale/chooseGoods')}">商品选购</a></li>-->
<!--			<li><a href="{:url('Aftersale/prints')}">交费打证</a></li>-->
		</ul>
        <form  class="form-horizontal js-ajax-form" method="post" action="{:url('Aftersale/burial')}">
        	<!--改版画面-->
            <div class="div_title"><span>客户概览</span></div>
        <div class="control-group1-p div_content">
            <fieldset>
                <div class="control-group1">
                    <label class="control-label">客户姓名</label>
                    <div class="controls">
                        <input type="text" class="form-control" value="{$result.buyer_name}" disabled>
                    </div>
                </div>
                <div class="control-group1">
                    <label class="control-label">持证类型</label>
                    <div class="controls">
                        <input type="text" class="form-control" value="{:cart_type('cart',$result.cart_type)}" disabled>
                    </div>
                </div>
                <div class="control-group1">
                    <label class="control-label">证件号码</label>
                    <div class="controls">
                        <input type="text" class="form-control" style="width:150px;" value="{$result.customer_account}" disabled>
                    </div>
                </div>
                <div class="control-group1">
                    <label class="control-label">联系电话</label>
                    <div class="controls">
                        <input type="text" class="form-control" value="{$result.buyer_phone}" disabled>
                    </div>
                </div>
                <div class="control-group1" style="width:40%;">
                    <label class="control-label">联系地址</label>
                    <div class="controls">
                        <input type="text" class="form-control" value="{$result.customer_address}" style="width:80%;" disabled>
                    </div>
                </div>
                <div class="control-group1">
                    <label class="control-label">合同编号</label>
                    <div class="controls">
                        <input type="text" class="form-control" value="{$result.contract_sn}" disabled>
                    </div>
                </div>
                <div class="control-group1">
                    <label class="control-label">购买日期</label>
                    <div class="controls">
                        <input type="text" class="form-control" value="{$result.gm_start_time}" disabled>
                    </div>
                </div>
                <div class="control-group1">
                    <label class="control-label">打证日期</label>
                    <div class="controls">
                        <input type="text" class="form-control" value="{$result.dz_start_time}" disabled>
                    </div>
                </div>
                <div class="control-group1">
                    <label class="control-label">保修状态</label>
                    <div class="controls">
                        <input type="text" class="form-control" value="{$result.end_bxq_time}" disabled>
                    </div>
                </div>
                <div class="control-group1">
                    <label class="control-label">当前状态</label>
                    <div class="controls">
                        <input type="text" class="form-control" value="{$result.col_status_name}" disabled>
                    </div>
                </div>
                <div class="control-group1">
                    <label class="control-label">维护期</label>
                    <div class="controls">
                        <input type="text" class="form-control" value="{$result.whq_status}" disabled>
                    </div>
                </div>
                <div class="control-group1">
                    <label class="control-label">墓位编号</label>
                    <div class="controls">
                        <input type="text" class="form-control" value="{$result.tomb_num}" disabled>
                    </div>
                </div>
                <div class="control-group1">
                    <label class="control-label">具体位置</label>
                    <div class="controls">
                        <input type="text" class="form-control" value="{$result.tomb_region}{$result.tomb_address}" disabled>
                    </div>
                </div>
                <div class="control-group1">
                    <label class="control-label">墓穴规制</label>
                    <div class="controls">
                        <input type="text" class="form-control" value="{$result.tomb_regulation_name}" disabled>
                    </div>
                </div>
                <div class="control-group1" style="width:20%;">
                    <label class="control-label" style="width:140px;">单个内穴最大尺寸</label>
                    <div class="controls" style="margin-left:150px;">
                        <input type="text" class="form-control" value="400mm*400mm*400mm" disabled>
                    </div>
                </div>
            </fieldset>
            <!---tab页-->
            <ul class="nav_tabs">
                <li class="active"><a href="javascript:">落葬登记</a></li>
                <li><a href="javascript:">落葬记录</a></li>
            </ul>
            <div class="control-group1-p nav_content">
            	<div class="content_nav">
                    <form action="{:url('stonepost/burial')}" method="post">
                	<div class="p_title">
                        <span class="span_title">逝者信息</span>
                    </div>
                    <div class="control-group1-p" style="border:1px solid #e2e2e2; padding-top:20px;margin:0 20px;overflow:hidden; overflow-x:auto;">
                        <table class="table table-hover table-bordered">
                            <thead>
                                <tr>
                                    <th>逝者姓名</th>
                                    <th>性别</th>
                                    <th>出生日期</th>
                                    <th>逝世日期</th>
                                    <th>预约落葬时间</th><!--<th>预约落葬时间</th>-->
                                    <th>收敛形式</th>
                                    <th >类型</th>
                                    <th>接待人</th>
                                    <th>持证人与使用人关系</th>
                                    <th>火化证明</th>
                                    <th>落葬费</th>
                                </tr>
                            </thead>
                            <tbody>
                            <for start="0" end="$result.tomb_regulation" >
                                <tr>
                                    <td>
                                        <input type="hidden"  name="deceased[{$i}][order_id]" value="{$result.order_id}">
                                        <input type="hidden"  name="deceased[{$i}][tomb_id]" value="{$result.tomb_id}">
                                        <input type="hidden"  name="deceased[{$i}][tomb_num]" value="{$result.tomb_num}">
                                        <input type="hidden"  name="deceased[{$i}][customer_id]" value="{$result.customer_id}">
                                        <input type="hidden"  name="deceased[{$i}][buried_id]" value="{:isset($deceased[$i]['buried_id'])?$deceased[$i]['buried_id']:''}">
                                        <input type="hidden"  name="deceased[{$i}][deceased_id]" value="{:isset($deceased[$i]['deceased_id'])?$deceased[$i]['deceased_id']:''}">
                                        <input type="hidden"  name="deceased[{$i}][buied_status]" value="{:isset($deceased[$i]['buied_status'])?$deceased[$i]['buied_status']:'0'}">
                                        <input type="text" class="form-control" name="deceased[{$i}][deceased_name]" value="{:isset($deceased[$i]['deceased_name'])?$deceased[$i]['deceased_name']:''}" style="width: 120px;">
                                    </td>
                                    <td><select name="deceased[{$i}][gender]" class="form-control">
                                        <if condition="isset($deceased[$i]['gender']) ">
                                            <option value='1'<if condition="'1' eq $deceased[$i]['gender']">selected</if>>男</option>
                                            <option value="2" <if condition="'2' eq $deceased[$i]['gender']">selected</if>>女</option>
                                            <else>
                                                <option value='1'>男</option>
                                                <option value="2">女</option>
                                            </else>
                                        </if>
                                        </select>
                                    </td>
                                    <td>
                                        <input type="text" class="form-control js-date" autocomplete="off" name="deceased[{$i}][date_birth]" value="{:isset($deceased[$i]['date_birth'])?$deceased[$i]['date_birth'] :''}" style="width: 120px;">
    <!--                                    <input type="text" class="form-control js-date" name="date_funeral[{$i}]" value="{$i}">-->
                                    </td>
                                    <td>
                                        <input type="text" class="form-control js-date" autocomplete="off"  name="deceased[{$i}][date_death]" value="{:isset($deceased[$i]['date_death'])?$deceased[$i]['date_death']:''}" style="width: 120px;">
                                    </td>
                                    <td>
                                        <input type="text" class="form-control js-datetime" autocomplete="off"  name="deceased[{$i}][funeral_time]" value="{:isset($deceased[$i]['funeral_time'])?$deceased[$i]['funeral_time']:''}" style="width: 200px;">
                                    </td>
                                    <td><select name="deceased[{$i}][convergence_type]" class="form-control">
                                        <if condition=" isset($deceased[$i]['convergence_type'])">
                                            <option value="1" <if condition=" $deceased[$i]['convergence_type'] eq 1"> selected </if>>骨灰</option>
                                            <option value="2" <if condition=" $deceased[$i]['convergence_type'] eq 2"> selected </if>>骨殖</option>
                                            <else/>
                                            <option value="1">骨灰</option>
                                            <option value="2">骨殖</option>
                                        </if>

                                        </select>
                                    </td>
                                    <td>
                                        <select name="deceased[{$i}][type]" id="tomb_cost" class="form-control">
                                        <if condition=" isset($deceased[$i]['type'])">
                                            <option value="1" <if condition=" $deceased[$i]['type'] eq 1"> selected </if>>首位安葬</option>
                                            <option value="2" <if condition=" $deceased[$i]['type'] eq 2"> selected </if>>合葬</option>
                                            <else/>
                                            <option value="1">首位安葬</option>
                                            <option value="2">合葬</option>
                                        </if>

                                        </select>
                                    </td>
                                    <td>
                                        <select name="deceased[{$i}][dep_id]" class="form-control">
                                            <foreach name="dep_list" item="vou">
                                                <if condition=" isset($deceased[$i]['dep_id'])">
                                                    <option value="{$vou.id}" <if condition=" $deceased[$i]['dep_id'] eq $vou.id"> selected </if>>{$vou.department_name}-{$vou.user_nickname}</option>
                                                    <else/>
                                                    <option value="{$vou.id}">{$vou.department_name}-{$vou.user_nickname}</option>
                                                </if>
                                            </foreach>
                                        </select>
                                    </td>
                                    <td><input type="text" style="width: 150px" class="form-control" name="deceased[{$i}][relationship_users]" value="{$deceased[$i]['relationship_users']|default=''}" style="width: 120px;"></td>
                                    <td>
                                        <php>$img_urls=cmf_get_image_preview_url(isset($deceased[$i]['cremation_certificate'])?$deceased[$i]['cremation_certificate']:'');</php>
                                        <input type="hidden" name="deceased[{$i}][cremation_certificate_file_id]" id="purchased_file{$i}-file_id" value="{$deceased[$i]['cremation_certificate_file_id']|default=''}">
                                        <input type="hidden" name="deceased[{$i}][cremation_certificate]" id="purchased_file{$i}" value="{$deceased[$i]['cremation_certificate']|default=''}">
                                        <a href="javascript:gpyUploadOneImage('上传证件', '#purchased_file{$i}','{$result.tomb_num}');"><h5 class="btn btn-primary">拍照上传</h5></a>
                                        <img style="cursor: pointer; height: 50px" onclick="parent.imagePreviewDialog(this.src);"  src="{$img_urls}" class="preview" id="purchased_file{$i}-preview" /></td>
                                    <td>
                                        <input type="hidden"   name="deceased[{$i}][funeral_price]"  value="{$costset.tomb_cost}">
                                        <input type="text" style="width: 100px" class="form-control tomb_cost" id="tomb_cost_1" name="deceased[{$i}][funeral_price]"  value="{$costset.tomb_cost}" disabled>
                                    </td>
                                </tr>
                            </for>
                            </tbody>
                        </table>
                  </div>
                  <div class="p_title">
                        <span class="span_title">联系人信息</span>
                    </div>
                    <div class="control-group1-p" style="border:1px solid #e2e2e2; padding-top:20px;margin:0 20px;overflow:hidden; overflow-x:auto;">
                    <table class="table table-hover table-bordered">
                        <thead>
                            <tr>
                                <th>办理人</th>
                                <th>性别</th>
                                <th>手机号码</th>
                                <th></th>
                                <th>关系</th>
                                <th>证件类型</th>
                                <th>证件号码</th>
                                <th>联系地址</th>
                                <th>证件上传</th>
                                <th>经办人</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                            	<td>
                                    <input type="hidden"   name="handle[buried_id]" value="{$handle.id|default=''}">
                                    <input type="hidden"   name="handle[service_status]" value="{$handle.service_status|default='0'}">
                                    <input type="text" class="form-control" name="handle[dealer_user]" value="{$handle.dealer_user|default=''}">
                                </td>
                                <td><select name="handle[dealer_sex]" class="form-control">
                                        <option value="1">男</option>
                                        <option value="2">女</option>
                                    </select>
                                </td>
                                <td><input type="text" class="form-control" name="handle[dealer_phone]" value="{$handle.dealer_phone|default=''}"></td>
                                <td><input type="checkbox" name="handle[is_sms]" value="1" checked="" >短信通知</td>
                                <td><select name="handle[contact_relation]" class="form-control">
                                        <option value="1">本人办</option>
                                        <option value="2">他人代办</option>
                                    </select></td>
                                <td><select name="handle[cart_type]" class="form-control">
                                        <option value="1">身份证</option>
                                        <option value="2">护照</option>
                                        <option value="3">军人证</option>
                                    </select></td>
                                <td><input type="text" class="form-control" name="handle[dealer_cart_no]" value="{$handle.dealer_cart_no|default=''}"></td>
								<td><input type="text" class="form-control" name="handle[dealer_address]" value="{$handle.dealer_address|default=''}"></td>
                                <td>
                                    <php>$img_urls=cmf_get_image_preview_url(isset($handle['cart_file'])?$handle['cart_file']:'');</php>
                                    <input type="hidden" name="handle[cart_file_id]" id="cart_file-file_id" value="{$result.cart_file_id|default=''}">
                                    <input type="hidden" name="handle[cart_file]" id="cart_file" value="{$result.cart_file|default=''}">
                                    <a href="javascript:gpyUploadOneImage('火化证明', '#cart_file','{$result.tomb_num}');">
                                        <h5 class="btn btn-primary">拍照上传</h5>
                                    </a>
                                    <img style="cursor: pointer; height: 50px" onclick="parent.imagePreviewDialog(this.src);"  src="{$img_urls}" class="preview" id="cart_file-preview" />
                                </td>
                                <td>
                                    <input type="hidden" name="handle[handle_name]"   value="{:cmf_get_admin_name()}" >
                                    <input type="text" class="form-control"  value="{:cmf_get_admin_name()}" disabled>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                  </div >
                  <div class="form-actions">
                      <if ($result.col_status)!=7>
                      <button type="submit" class="quan btn btn-primary js-ajax-submit">保存</button>
                      </if>
                    </div>
                </form>
                </div>
                	<div class="content_nav feature">
                	<div class="p_title">
                        <span class="span_title">落葬记录</span>
                    </div>
                    <div class="control-group1-p" style="border:1px solid #e2e2e2; padding-top:20px;margin:0 20px;overflow:hidden; overflow-x:auto;">
                    <table class="table table-hover table-bordered" >
                        <thead>
                            <tr>
                                <td width="20"></td>
                                <th width="8%">逝者姓名</th>
                                <th width="7%">性别</th>
                                <th width="15%">生卒日期</th>
                                <th width="10%">落葬时间</th>
                                <th width="8%">收敛形式</th>
                                <th  width="8%">落葬类别</th>
                                <th  width="8%">与持证人关系</th>
                                <th  width="8%">火化证明</th>
                                <th  width="8%">办理人信息</th>
                                <th  width="8%">接待部门</th>
                                <th  width="8%">执行情况</th>
                            </tr>
                        </thead>
                        <tbody id="log_list">
                        <foreach name="buried_list" item="vo">
                            <tr>
                                <td width="20">
                                    <input type="radio" class="buried_id js-check " data-direction="y" data-payId="{$vo.buried_id}" data-checklist='orderid' />
                                </td>
                                <td width="8%">{$vo.deceased_name}</td>
                                <td><if ($vo.gender)==1>男  <elseif ($vo.gender)==2/> 女  </if> </td>
                                <td>{$vo.date_birth}-{$vo.date_death}</td>
                                <td>{$vo.funeral_time}</td>
                                <td><if ($vo.convergence_type)==1>骨灰  <elseif ($vo.convergence_type)==2/> 骨殖  </if></td>
                                <td><if ($vo.type)==1>首位落葬  <elseif ($vo.type)==2/> 合葬  </if></td>
                                <td>{$vo.dealer_user}</td>
                                <td>
                                    <php>$img_url=cmf_get_image_preview_url(isset($vo['cremation_certificate'])?$vo['cremation_certificate']:'');</php>
                                    <a href="javascript:;" datasrc="{:cmf_get_image_preview_url($vo['cremation_certificate'])}"
                                       onclick="parent.imagePreviewDialog('{$img_url}');">查看</a> | <a href="{$img_url}" download = '导出'>导出</a></td>
                                <td>
                                    <a href="javascript:" class="lookCustomer" data-title="办理人信息" data-url="?t=9&id={$vo.customer_id}">查看详情({$vo.dealer_user})</a>
                                </td>
                                <td>{$vo.handle_name}</td>
                                <td>
                                   <!-- <if ($vo.service_status)==1>--><label style="color:#FF0000">未确认</label>
                                   <!-- <elseif ($vo.service_status)==2/>-->
                                            <label style="color:#87CEFA">已确认</label>
                                    <!--<elseif ($vo.service_status)==3/>-->
                                                <label style="color:#43CD80">已完成</label>
                                   <!-- </if>-->
                                </td>
                            </tr>
                        </foreach>

                        </tbody>
                    </table>
                    <div class="pagination">{$page}</div>
                  </div>
                  <div class="form-actions">
                  <div class="btn btn-primary print"  id="">补打结算单</div>
                        <div class="btn btn-primary" id="check-btn">补打登记</div>
                    </div>
                </div>
            </div>
        </div>
        </form>
    </div>
    <div id="print_html" style="display: none"></div>

    <iframe id="printf" src="" width="0" height="0" frameborder="0"></iframe>

	<script type="text/javascript">
       var index_type  = 1;
	//切换显示
	$(document).on('click','.nav_tabs li',function(){
		$(this).addClass('active').siblings().removeClass('active');
		var index = $(".nav_tabs li").index(this);
		billtype = index;
		console.log(index);
		$('.content_nav').eq(index).removeClass("feature").siblings().addClass("feature");
    });
	 // 提交订单
	$("#check-btn").click(function(){
		$.post($("form").attr('action'), $("form").serialize(), function(result){
			if(result.state == 'success'){
				alert("保存成功！");
				$('#js-dialog-close').click();
			} else {
				alert(result.info);
			}
		}, 'json');
	});

	//补打结算单
	$('.print').click(function () {
        var payId = $("#log_list").find('.buried_id:checked').attr('data-payId');
        console.log(payId)
        if (payId !=0) {
            $.ajax({
                type: "get", url:"{:url('Print/print_cert')}?mark=4&type=3&itype=3&id="+payId,
                success: function (strHtml) {
                    console.log('打印')
                    var data = strHtml.data;
                    $('#print_html').html(data.html)
                    preViewPrint('服务结算单',3,7)
                }
            })
        }else {
            layer.msg('清选择打印的数据');
        }
    })

       layer.alert('是否已办理墓碑刻制业务？', {icon:3, yes: function (index) {}})
    </script>
    <script type="text/javascript" src="__STATIC__/js/lodop/LodopFuncs.js?v={:time()}"></script>
    <script type="text/javascript" src="__STATIC__/js/print.js?1"></script>
    <script type="text/javascript" src="__STATIC__/js/admin.js?v={:time()}"></script>
    <script type="text/javascript" src="__STATIC__/js/init_base.js?v={:time()}"></script>
</body>
</html>